package com.aspose.cells;

import java.util.ArrayList;

class zbqh extends zbz {
   private ArrayList a = null;

   zbqh() {
      this.c(430);
   }

   void a(zbqg var1, int var2) throws Exception {
      switch(var1.a()) {
      case 0:
         if (var1.c() == null) {
            this.a(var1.i());
         } else {
            this.a(var1.i(), var1.c());
         }
         break;
      case 1:
         this.a(var2);
         break;
      case 2:
         this.a();
         break;
      case 3:
      case 4:
         this.a(var1.i());
      }

   }

   void a(int var1) {
      this.b(4);
      this.c = new byte[4];
      this.c[0] = com.aspose.cells.b.a.zc.a(var1)[0];
      this.c[1] = com.aspose.cells.b.a.zc.a(var1)[1];
      this.c[2] = 1;
      this.c[3] = 4;
   }

   void a() {
      this.b(4);
      this.c = new byte[4];
      this.c[0] = 1;
      this.c[2] = 1;
      this.c[3] = 58;
   }

   void a(String var1) throws Exception {
      byte[] var2 = zakq.a(var1);
      this.a((short)(5 + var2.length));
      this.c = new byte[this.d()];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1.length()), 0, this.c, 2, 2);
      this.c[4] = (byte)(var1.length() == var2.length ? 0 : 1);
      System.arraycopy(var2, 0, this.c, 5, var2.length);
   }

   void a(String var1, String[] var2) throws Exception {
      byte[] var3 = zakq.a(var1);
      this.a((short)(5 + var3.length));
      byte[][] var4 = new byte[var2.length][];
      int var5 = -1;

      int var6;
      int var7;
      for(var6 = 0; var6 < var2.length; ++var6) {
         var4[var6] = zakq.a(var2[var6]);
         if (var5 == -1) {
            var7 = 3 + (var4[var6] == null ? 0 : var4[var6].length);
            if (this.d() + var7 > 8224) {
               var5 = var6;
            } else {
               this.b(this.d() + (short)var7);
            }
         }
      }

      this.c = new byte[this.d()];
      System.arraycopy(com.aspose.cells.b.a.zc.a(var2.length), 0, this.c, 0, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1.length()), 0, this.c, 2, 2);
      this.c[4] = (byte)(var1.length() == var3.length ? 0 : 1);
      System.arraycopy(var3, 0, this.c, 5, var3.length);
      var6 = 5 + var3.length;
      var7 = var5 == -1 ? var2.length : var5;

      int var8;
      for(var8 = 0; var8 < var7; ++var8) {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2[var8].length()), 0, this.c, var6, 2);
         if (var4[var8] == null) {
            this.c[var6 + 2] = 0;
            var6 += 3;
         } else {
            this.c[var6 + 2] = (byte)(var2[var8].length() == var4[var8].length ? 0 : 1);
            System.arraycopy(var4[var8], 0, this.c, var6 + 3, var4[var8].length);
            var6 += 3 + var4[var8].length;
         }
      }

      if (var5 != -1) {
         var8 = 0;
         this.a = new ArrayList();

         for(int var9 = var5; var9 < var2.length; ++var9) {
            int var10 = 3 + (var4[var9] == null ? 0 : var4[var9].length);
            if (var8 + var10 > 8224) {
               byte[] var11 = new byte[var8];

               for(var6 = 0; var5 < var9; ++var5) {
                  System.arraycopy(com.aspose.cells.b.a.zc.a(var2[var5].length()), 0, var11, var6, 2);
                  if (var4[var5] == null) {
                     var11[var6 + 2] = 0;
                     var6 += 3;
                  } else {
                     var11[var6 + 2] = (byte)(var2[var5].length() == var4[var5].length ? 0 : 1);
                     System.arraycopy(var4[var5], 0, var11, var6 + 3, var4[var5].length);
                     var6 += 3 + var4[var5].length;
                  }
               }

               zmo var12 = new zmo();
               var12.b(var11);
               com.aspose.cells.b.a.a.ze.a(this.a, (Object)var12);
               var8 = 0;
            }

            var8 += var10;
         }

         if (var8 != 0) {
            var6 = 0;

            byte[] var13;
            for(var13 = new byte[var8]; var5 < var2.length; ++var5) {
               System.arraycopy(com.aspose.cells.b.a.zc.a(var2[var5].length()), 0, var13, var6, 2);
               if (var2[var5] == null) {
                  var13[var6 + 2] = 0;
                  var6 += 3;
               } else {
                  var13[var6 + 2] = (byte)(var2[var5].length() == var4[var5].length ? 0 : 1);
                  System.arraycopy(var4[var5], 0, var13, var6 + 3, var4[var5].length);
                  var6 += 3 + var4[var5].length;
               }
            }

            zmo var14 = new zmo();
            var14.b(var13);
            com.aspose.cells.b.a.a.ze.a(this.a, (Object)var14);
         }
      }

   }

   void a(zqa var1) throws Exception {
      Object var2 = null;
      byte[] var5 = new byte[this.c.length + 4];
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.f()), 0, var5, 0, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.d()), 0, var5, 2, 2);
      System.arraycopy(this.c, 0, var5, 4, this.c.length);
      var1.a(var5);
      if (this.a != null && this.a.size() != 0) {
         for(int var3 = 0; var3 < this.a.size(); ++var3) {
            zmo var4 = (zmo)this.a.get(var3);
            var4.a(var1);
         }
      }

   }
}
